/**
 * Created by Administrator on 2017/8/5.
 */

$(document).ready(function () {

    var shoptpl=$('#discount-list-template').html();

    var shopTemplate=Handlebars.compile(shoptpl);
    var selectTpl=$('#select-template').html();
    var selectCmp=Handlebars.compile(selectTpl);

    var uri=C.interface.discount;
    var selectUri=C.interface.selectType;

    //获取商品类别
    $.ajax({
        url:selectUri,
        type:'get',
        dataType:'json',
        data:{},
        success:function (response) {
            if (response.result=='success'){
                var selectData=response.data;
                $('#dis-select-box').html(selectCmp(selectData));
                /*筛选按钮的切换*/
                $('.dis-screen-btn').click(function () {
                    $(this).toggleClass('dis-screen-active');
                    $('.dis-screen').toggle();
                });

            }else if (response.result=='login'){
                alert('您还没有登录，请登录');
            }else {
                alert(response.errorMsg);
            }
        }

    });



});


